// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "ds/typography.scss" as *;
@use "refactor/common-refactor.scss" as deprecated;

.token-context-menu {
  position: absolute;
  z-index: deprecated.$z-index-4;
}

.token-context-menu[data-direction="up"] {
  bottom: var(--bottom);
}

.token-context-menu[data-direction="down"] {
  top: var(--top);
}

.context-list,
.token-context-submenu {
  @include deprecated.menuShadow;
  display: grid;
  width: deprecated.$s-240;
  padding: deprecated.$s-4;
  border-radius: deprecated.$br-8;
  border: deprecated.$s-2 solid var(--color-background-quaternary);
  background-color: var(--color-background-tertiary);
  max-height: 100vh;
  overflow-y: auto;
}

.token-context-submenu {
  display: none;
}

.token-context-submenu-top {
  bottom: 80px;
}

.token-context-submenu {
  position: absolute;
  padding: deprecated.$s-4;
  margin-left: deprecated.$s-6;
}

.separator {
  margin: deprecated.$s-6;
  border-block-start: deprecated.$s-1 solid var(--panel-border-color);
}

.context-menu-item {
  --context-menu-item-bg-color: none;
  --context-menu-item-fg-color: var(--color-foreground-primary);
  --context-menu-item-border-color: none;
  @include use-typography("body-small");
  display: flex;
  align-items: center;
  height: deprecated.$s-32;
  width: 100%;
  padding: deprecated.$s-8;
  border-radius: deprecated.$br-8;
  color: var(--context-menu-item-fg-color);
  background-color: var(--context-menu-item-bg-color);
  border: deprecated.$s-1 solid var(--context-menu-item-border-color);
  cursor: pointer;
  &:hover {
    --context-menu-item-bg-color: var(--color-background-quaternary);
  }

  &:focus {
    --context-menu-item-bg-color: var(--menu-background-color-focus);
    --context-menu-item-border-color: var(--color-background-tertiary);
  }

  &[aria-selected="true"] {
    --context-menu-item-bg-color: var(--color-background-quaternary);
  }
}

.context-menu-item-hint-wrapper {
  position: relative;
}

.context-menu-item-selected {
  & .icon-wrapper {
    color: var(--color-accent-primary);
  }
}

.context-menu-item-unselected {
  color: var(--color-foreground-secondary);

  & .icon-wrapper {
    color: var(--color-background-quaternary);
  }

  &:hover {
    color: var(--color-foreground-primary);

    & .icon-wrapper {
      color: var(--color-foreground-secondary);
    }
  }
}

.context-menu-item-hint {
  position: absolute;
  background-color: var(--color-background-primary);
  border-radius: deprecated.$br-6;
  padding: deprecated.$s-4;
  inset-inline-end: deprecated.$s-4;
  inset-block-start: deprecated.$s-4;
  color: var(--color-foreground-secondary);
}

.item-text {
  flex-grow: 1;
}

.item-with-icon-space {
  padding-left: deprecated.$s-20;
}
.icon-wrapper {
  margin-right: deprecated.$s-4;
}
